<style>
.content-group {background:#fff;border-radius: 0.5rem;margin-bottom:0.39rem}
.merchname {display:none}
.fui-tab-scroll .item a {color:#fff;font-weight:400}
.fui-tab-scroll .item.on,.fui-tab-scroll .item.on a{color:#fff;}
.fui-tab-scroll .item.on:before {background:linear-gradient(to right,rgba(255,255,255,1),rgba(255,255,255,0));}
.fui-icon-group .fui-icon-col {
    margin: 0.1rem 0;
}
.carousel {margin-top:0}
.fui-header:after {
	border-bottom: 0 solid #D9D9D9;
}
.fui-notice:after, .fui-notice:before  {
	border-bottom: 0 solid #D9D9D9;
	border-top: 0 solid #D9D9D9;
}
.bottombg {position: absolute;margin-top:-0.5rem;width:100%;height:0.5rem;border-top-right-radius:0.5rem;border-top-left-radius:0.5rem;}
.topbg {height:4rem;}
.topbg.nosearch{height:2rem;}
.search-input i {
    color: {{main.syscolor||'#b4b4b4'}};
}
.search-input input {
	border: 0 solid #b4b4b4;
}
.radius .jy-group {border-radius:0.5rem;margin:0.2rem 0.5rem}
</style>
<div ng-include="sys_html('common/_header','','','jy_weishop')"></div>
<div ng-if="pagedata.nodatapic_close" class="fui-page fui-page-current page-goods-list">
<div class='fui-content' style="top:0">
	<div ng-class="{'topbg':1,'nosearch':pagedata.pluginset.issearch==1}" style="position: relative;text-align:center;width:100%;background: {{main.syscolor || '#7c1cc9'}};">
		<div class="fui-cell-group" style="margin-top:0;background:none;">
		<div class="fui-cell" style="background:none;padding:0 0.5rem">
			<div class="fui-cell-label" style="width:auto">
				<span class="bold" style="color:#fff">{{pagedata.myshop.merchname || pagedata.pluginset.title}}</span>
			</div>
			<div class="fui-cell-info" style="line-height: 2.4rem;color:#fff;text-align:right">
				<span class="overflow-h" style="margin-right:0.5rem;">
					<i class="icon jinyunicon icon-map" style="font-size: 0.65rem;"></i>
					<span style="font-size: 0.65rem;width:6rem;overflow: hidden">{{pagedata.pcd.street||'默认收货地址'}}</span>
				</span>
			</div>
			<div class="fui-cell-remark noremark" style="color:#fff;">
				<i ng-if="main.isapp!=1" class="icon icon-saoyisao1" ng-click="pagedata.scancode()" style="font-size: 0.8rem;margin-right:0.2rem"></i>
				<i ng-if="main.isapp!=1" class="icon icon-fenxiang2" onclick="$('#showsharecover').modal();" style="font-size: 0.85rem;margin-right:0.2rem"></i>
				<i class="icon icon-liaotian" ng-click="access_json('jy_merch/member.index/')" style="font-size: 0.9rem;"></i>
			</div>
		</div>
		</div>
		<div ng-if="pagedata.pluginset.issearch!=1" class="fui-cellone" style="padding-bottom:0;padding-top:0;padding-right:0.4rem;z-index: 108;top:0;">
			 <div class="fui-cellone-info">
				<div class="search-input" style="height:1.6rem">
					<i id="searchsub" class="icon icon-sousuo1 bold" ng-click="access_json('jy_merch/goods.index//keyword='+pagedata.params.keyword)" style="line-height: 1.7rem;"></i>
					<input type="search" placeholder="搜索商品" class="search" ng-model="pagedata.params.keyword" style="height:1.6rem;text-align: left; color: #999; font-size:0.6rem;background:#f9f9f9;border-radius: 1rem;" />
				</div>
			 </div>
			 <div class="fui-cellone-remark">
			 	<span style="margin-left:0.3rem;font-size: 0.75rem;color:#fff" ng-click="access_json('jy_merch/goods.index//keyword='+pagedata.params.keyword)">搜索</span>
				<span ng-click="access_json('jy_merch/shop.groups/')" style="background:#;margin-left:0.3rem;font-size: 0.75rem;color:#fff"><i class="icon icon-viewlist"></i> 分类</span>
			 </div>
		</div>
	</div>
	<div class="fui-tab-scroll" style="background: {{main.syscolor || '#7c1cc9'}};padding-bottom:0.5rem;height:2.9rem">
		<div ng-class="{'item':1,'on':pagedata.params.pid==0}" style="height:2rem;line-height:1.5rem"><a href="javascript:;" ng-click="pagedata.params.pid=0;tool.get_list('jy_merch/goods.index/getlist/order=ishot',true)">推荐</a></div>
		<div ng-repeat="tab in pagedata.category" style="height:2rem;line-height:1.5rem" ng-class="{'item':1,'on':pagedata.params.pid==tab.id}"><a href="javascript:;" ng-click="pagedata.params.pid=tab.id;pagedata.params.cid=0;pagedata.groupkey=$index;tool.get_list('jy_merch/goods.index/getlist/pcate='+tab.id,true)">{{tab.title}}</a></div>
		<div ng-if="!pagedata.category || pagedata.category.length<1" ng-class="{'item':1,'on':pagedata.params.pid==-1}" style="height:2rem;line-height:1.5rem"><a href="javascript:;" ng-click="pagedata.params.pid=-1;pagedata.params.cid=0;pagedata.groupkey=$index;tool.get_list('jy_merch/goods.index/getlist/',true)">其他商品</a></div>
	</div>
	<div class="bottombg" style="background:#f7f7f7;"></div>
	<div ng-if="pagedata.params.pid==0" ng-include="sys_html('shop/_hdps','','','jy_weishop')" class="radius" style="padding:0 0.5rem;"></div>
	<div ng-if="pagedata.params.pid==0" class="radius" style="padding: 0.3rem;width:100%">
		<div class="bgnone" ng-include="sys_html('shop/_bankuai1','','','jy_weishop')"></div>
	</div>
	<div ng-if="pagedata.params.pid==0" ng-repeat="item in pagedata.setting.indexcube" class="fui-cube" ng-click="access_json(item.url)" style="padding:0.3rem 0.5rem;height:auto">
		<img style="height:auto" ng-src="{{tomedia(item.image) ||'../addons/jy_weishop/resource/images/mobile-hdp02.jpg'}}"/>
	</div>
	<div style="margin-top:-0.2rem;padding:0 0.3rem" ng-include="sys_html('shop/_showtypegoods','','','jy_merch')"></div>
</div>
</div>
<div ng-include="sys_html('common/_share','','','jy_weishop')"></div>
<div ng-include="sys_html('common/_sales','','','jy_weishop')"></div>
<div ng-include="sys_html('common/_mfooter')"></div>
<div ng-include="sys_html('common/_footer','','','jy_weishop')"></div>
<div ng-if="pagedata.nodatapic_close" ng-include="sys_html('common/_coupon',true)"></div>
<div ng-if="pagedata.nodatapic_close" ng-include="sys_html('common/_h5game',true)"></div>
<div ng-include="sys_html('common/_gotop',true)"></div>
<div ng-include="sys_html('common/_welcomehdp',true)"></div>
<!--弹目-->
<div ng-if="pagedata.showtanmus && !pagedata.pluginset.no_tanmu" class="video-sms-pane {{pagedata.transition?'transition':''}}">
		<div class="video-sms-text">
			<image class="video-sms-logo" ng-src="{{pagedata.tanmus[pagedata.nowmsgid].avatar}}"/>
			<span class="overflow-h"> 最新订单来自 {{pagedata.tanmus[pagedata.nowmsgid].nickname}}</span>
		</div>
</div>
<script>
scope.pagedata.issocketmsg=false;
scope.pagedata.tanmuspage=0;
scope.pagedata.isa2=true;
scope.pagedata.isno_coupontop=1;
scope.pagedata.gettanmus=function() {
	if(!scope.pagedata.issocketmsg){
			scope.pagedata.nowmsgid=0;
			scope.get('jy_weishop/get_data/gettanmus/page='+scope.pagedata.tanmuspage,function(res){
						//console.log(res);
						scope.pagedata.tanmus=res.list
						if(scope.pagedata.tanmus.length>0){
							scope.pagedata.tanmuspage++;
							scope.pagedata.up_oldtanmu();
						}
			});
	}
}
//前端先注册以等待接收消息
require(['jinyun_socket'],function(jinyun_socket){	
    jinyun_socket.connect(function(res){
			console.log('加入ID为index的组：');console.log(res);
            jinyun_socket.join('index');//加入ID为1的组
     });	 
    jinyun_socket.onsystem=function(res){
        console.log('收到来自后端的消息：');console.log(res);
		scope.pagedata.issocketmsg=true;
		if(scope.pagedata.pluginset.no_tanmu!=1){
			set_tanmu(res.nickname,res.avatar,res.time);
		}
    }
	//刚进入时；如果没有新订单消息，就弹储备订单消息
	if(scope.pagedata.pluginset.no_tanmu!=1){
		setTimeout(function(){
			scope.pagedata.gettanmus();
		},2000);
	}
});
scope.pagedata.up_oldtanmu=function() {
		if(scope.page.action=='index'){
			var i=scope.pagedata.nowmsgid;
			if(i<scope.pagedata.tanmus.length){
				set_tanmu(scope.pagedata.tanmus[i].nickname,scope.pagedata.tanmus[i].avatar,scope.pagedata.tanmus[i].time);
			}else{
				scope.pagedata.gettanmus();
			}
		}else{
			return false;
		}
}
function set_tanmu(nickname,avatar,time) {
		scope.pagedata.nowmsgid++
		scope.pagedata.showtanmus=true
		scope.$evalAsync(scope.pagedata.showtanmus);
		setTimeout(function(){
			scope.pagedata.transition=true
			scope.$evalAsync(scope.pagedata.transition);	
		},300);
		setTimeout(function(){
			scope.pagedata.showtanmus=false
			scope.pagedata.transition=false
			scope.$evalAsync(scope.pagedata.showtanmus);	
		},2000);
		setTimeout(function(){
			//等待5秒，如果没有新的订单消息，就弹储备订单消息
			scope.pagedata.issocketmsg=scope.pagedata.issocketmsg?scope.pagedata.issocketmsg:false;
			if(!scope.pagedata.issocketmsg && scope.page.action=='index'){
				scope.pagedata.up_oldtanmu();
			}
		},4000);
}
// 百度地图API功能
if(!scope.pagedata.lat_lng || !scope.pagedata.pcd.street){
	window.scope.location(function(re){
		if(re.lat_lng){
			scope.pagedata.pcd=re.addressComponents;
			scope.pagedata.pcd.street=scope.pagedata.pcd.street_recommend?scope.pagedata.pcd.street_recommend:scope.pagedata.pcd.street;
		}
	},scope.pagedata.pluginset.no_location);
}
//手机软键盘--搜索
$("body").keydown(function() {
    if (event.keyCode == "13") {
        $('#searchsub').click();
    }
});
scope.pagedata.scancode=function () {
			console.log('scanQRCodeOK');
			wx.scanQRCode({
				needResult: 1, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
				scanType: ["qrCode","barCode"], // 可以指定扫二维码还是一维码，默认二者都有
				success: function (res) {
					var result = res.resultStr; // 当needResult 为 1 时，扫码返回的结果
					location.href = result;
				}
			});
}
</script>